﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;

namespace Mate.Db.SqlSugar
{
    public class DataSettings
    {
        public string DetaultConnectionString { get; set; }

        public string DbType { get; set; }

        public bool IsAutoCloseConnection { get; set; }

        public bool IsEnableLogEvent { get; set; }

        public DbType GetDbType()
        {
            if (string.IsNullOrWhiteSpace(DbType))
            {
                throw new ArgumentNullException("DbType为空", "请检查配置文件");
            }
            foreach (DbType item in Enum.GetValues(typeof(DbType)))
            {
                if (item.ToString().ToLower() == DbType.ToLower())
                {
                    return item;
                }
            }
            throw new ArgumentNullException("DbType配置错误", "请检查配置文件");
        }
    }
}
